<?php

namespace app\common\model;

use think\Model;
use think\Db;

/**
 * 促销活动模型
 */
class PromGoods extends Model
{
    /**
     * 获取促销及其商品
     */
    public function getPromGoodsList(){


    }


    public function goods(){
        return $this->hasMany('Goods','id','goods_id')->field('id,name,image,shop_price,prom_type,prom_id')->where(['prom_type' => '4']);
    }

    public function getGoodsList($prom_id){
        $data = Db::name('goods')->where(['prom_type' => '4','prom_id' => $prom_id,'status' => '1'])->field('id,name,image,shop_price,prom_type,prom_id')->order('weigh desc')->limit(5)->select();

        return $data;
    }


}